package com.ruoyi.system.service.impl;

import com.ruoyi.common.utils.DateUtil;
import lombok.var;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.Random;

import static cn.hutool.core.date.DatePattern.NORM_DATETIME_PATTERN;


@Service
public class MaterialCommonImpl {


    private final Random random = new Random();
    /*
     *  创造类似 收-01#-202410-0027 单号
     * */
    public String createMaterialCode(boolean isIn) {

        var flag = "收";

        if (!isIn) {
            flag = "发";
        }

        flag = flag + "-04#-" + DateUtil.dateToString(new Date(), NORM_DATETIME_PATTERN);

        flag = flag + (random.nextInt(10000) + 1);

        return flag;

    }
}
